package com.ccg.controller;

import com.ccg.entity.Message;
import com.ccg.entity.RoomType;
import com.ccg.service.RoomTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@RequestMapping("/admin/roomType")
@Controller
public class RoomTypeController {
    @Autowired
    RoomTypeService roomTypeService;

    @RequestMapping("/getAllRoomType")
    @ResponseBody
    public Message getAllRoomType(){
        return new Message(0,"查找成功",roomTypeService.findAllTypeName());
    }
    @RequestMapping("/updateRoomType")
    @ResponseBody
    public Message updateRoomType(RoomType roomType){
        int i;
        String str;
        if(roomTypeService.updateRoomType(roomType)==1){
            i=0;
            str="修改房间类型信息成功";
        }
        else{
            i=1;
            str="修改房间类型信息失败";
        }
        return new Message(i,str,null);
    }
}
